package com.itheima.state;

public class Demo03 {

    public static void main(String[] args) throws InterruptedException {
        Object o = new Object();
        Thread t1 = new Thread(()->{
            synchronized (o){
                try {
                    Thread.sleep(2000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }

            }
        });
        t1.start();
        Thread.sleep(100);
        Thread t2 = new Thread(()->{
            synchronized (o){
                Thread.State state = Thread.currentThread().getState();

                System.out.println("获取到了锁以后的状态"+state);

            }
        });
        t2.start();
        Thread.sleep(100);
        Thread.State state = t2.getState();
        System.out.println("被别人获取到了锁,等待时的状态"+state);

    }
}
